from helpers import updateInfo
from helpers import Transactions
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app

class MainPage(webapp.RequestHandler):
    """ Weekly cron job class """
    def get(self):
        updateAll()

def updateAll():
        """ Buy Virtual Investors stocks, change ETF content and update Weekly bank amounts of users """
        Transactions.buyForMonkey(1)
        Transactions.buyForMonkey(2)
        Transactions.buyForMonkey(3)
        Transactions.ETFChange()
        updateInfo.lastWeekAmount()
            
application = webapp.WSGIApplication(
                                     [('/crondir/cronjobweekly', MainPage)],
                                     debug=True)

def main():
    run_wsgi_app(application)

if __name__ == "__main__":
    main()